<template>
  <header class="header">
    <h1>todos</h1>
    <input
      class="new-todo"
      placeholder="请输入任务名称"
      autofocus
      v-model="username"
      @keyup.enter="InputChang"
    />
  </header>
</template>

<script>
export default {
  name: 'Hand',
  props: {},
  data () {
    return {
      username: ''
    }
  },
  methods: {
    InputChang () {
      const obj = {
        id: +new Date(),
        name: this.username,
        isflag: false
      }
      this.$emit('InputChang', obj)
      this.username = ''
    }
  }
}
</script>

<style scoped lang="less"></style>
